class DistilabelConf:
    mode: int = 0
    OLLAMA_HOST: str = "http://localhost:11434"
    MODEL_NAME: str = "gpt-oss:120b"

    CHUNK_SIZE: int = 1024
    CHUNK_OVERLAP: int = 102

    MAX_GOLDENS_PER_CONTEXT: int = 3

    OUTPUT: str = "distilabel"

    def __init__(self, OLLAMA_HOST="http://localhost:11434", MODEL_NAME="", mode=0,
                 OUTPUT="Distilabel", MAX_GOLDENS_PER_CONTEXT=10, CHUNK_SIZE=1024, CHUNK_OVERLAP=100):
        self.OLLAMA_HOST = OLLAMA_HOST
        self.MODEL_NAME = MODEL_NAME
        self.mode = mode
        self.OUTPUT = OUTPUT
        self.MAX_GOLDENS_PER_CONTEXT = MAX_GOLDENS_PER_CONTEXT
        self.CHUNK_SIZE = CHUNK_SIZE
        self.CHUNK_OVERLAP = CHUNK_OVERLAP


# 模块级单例
_config: DistilabelConf | None = None

def set_distilabel_config(config: DistilabelConf | dict):
    """初始化或覆盖全局配置"""
    global _config
    if isinstance(config, dict):
        _config = DistilabelConf(**config)
    else:
        _config = config

    print(f"set_distilabel_config {config}")

def get_distilabel_config() -> DistilabelConf:
    """获取模块全局配置"""
    if _config is None:
        raise RuntimeError("Config not initialized! Call set_config first.")
    return _config